﻿using Microsoft.SharePoint;
using SPCoder.Utils.Nodes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SPCoder.Utils
{
    public class SSOMConnector : BaseConnector
    {
        public override Nodes.BaseNode GetSPStructure(string siteUrl)
        {
            return null;
            //SPSite site = new SPSite(siteUrl);
            //BaseNode rootNode = new SPSiteNode(site);
            //rootNode.OMType = ObjectModelType.SSOM;
            //rootNode.SPObject = site;
            //doSPWeb(site.RootWeb, rootNode, rootNode);
            //return rootNode;
        }

        //private void doSPWeb(SPWeb web, BaseNode parentNode, BaseNode rootNode)
        //{
        //    BaseNode myNode = new SPWebNode(web);
        //    parentNode.Children.Add(myNode);
        //    myNode.ParentNode = parentNode;
        //    myNode.RootNode = rootNode;

        //    foreach (SPWeb childWeb in web.Webs)
        //    {
        //        doSPWeb(childWeb, myNode, rootNode);
        //    }

        //    foreach (SPList list in web.Lists)
        //    {
        //        BaseNode myListNode = new SPListNode(list);
        //        myNode.Children.Add(myListNode);
        //        myListNode.ParentNode = myNode;
        //        myListNode.RootNode = rootNode;
        //    }
        //    web.Dispose();
        //}
    }
}
